package LeetCode.LeetCode2;

import java.util.Arrays;

public class Num50 {
    public static char firstUniqChar(String s) {
        if(s.length() == 0){
            return ' ';
        }
        char []arr = s.toCharArray();
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr.length; j++) {
                if(arr[i] == arr[j] && i!=j){
                    break;
                }else if(j ==arr.length-1 && i == arr.length-1){
                    return arr[i];
                } else if(j ==arr.length-1 && arr[i] != arr[j]){
                    return arr[i];
                } else if(arr[i] != arr[j]){
                    continue;
                }
            }
        }
        return ' ';
    }

    public static void main(String[] args) {
        String s = "dddccdbba";
        System.out.println(firstUniqChar(s));
    }
}
